{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: replacing module ResNet.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Main.ResNet"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "include(\"resnet.jl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "julia resnet.jl image-file-or-url\n",
       "\n",
       "This example implements the ResNet-50, ResNet-101 and ResNet-152 models from 'Deep Residual Learning for Image Regocnition', Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun, arXiv technical report 1512.03385, 2015.\n",
       "\n",
       "  * Paper url: https://arxiv.org/abs/1512.03385\n",
       "  * Project page: https://github.com/KaimingHe/deep-residual-networks\n",
       "  * MatConvNet weights used here: http://www.vlfeat.org/matconvnet/pretrained\n"
      ],
      "text/plain": [
       "  julia resnet.jl image-file-or-url\n",
       "\n",
       "  This example implements the ResNet-50, ResNet-101 and ResNet-152 models from 'Deep Residual Learning for Image Regocnition', Kaiming He, Xiangyu\n",
       "  Zhang, Shaoqing Ren, Jian Sun, arXiv technical report 1512.03385, 2015.\n",
       "\n",
       "    •    Paper url: https://arxiv.org/abs/1512.03385\n",
       "\n",
       "    •    Project page: https://github.com/KaimingHe/deep-residual-networks\n",
       "\n",
       "    •    MatConvNet weights used here: http://www.vlfeat.org/matconvnet/pretrained"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@doc ResNet"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "usage: <PROGRAM> [--model MODEL] [--top TOP] [--atype ATYPE] [image]\n",
      "\n",
      "resnet.jl (c) Ilker Kesen, 2017. Classifying images with Deep Residual\n",
      "Networks.\n",
      "\n",
      "positional arguments:\n",
      "  image          Image file or URL. (default:\n",
      "                 \"https://github.com/BVLC/caffe/raw/master/examples/images/cat.jpg\")\n",
      "\n",
      "optional arguments:\n",
      "  --model MODEL  resnet model name (default:\n",
      "                 \"imagenet-resnet-101-dag\")\n",
      "  --top TOP      Display the top N classes (type: Int64, default: 5)\n",
      "  --atype ATYPE  array and float type to use (default:\n",
      "                 \"KnetArray{Float32}\")\n",
      "\n"
     ]
    }
   ],
   "source": [
    "ResNet.main(\"--help\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHwAAACgCAIAAABBgJ+9AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAtQ0lEQVR42u2dya8k2XXefzHm/IZ6VV1dzWYXu5vN5iTCpCQLlG3Ski0BFiDAsCBvvLAWXhnwHyMv9F9YgOBB4MIAZVOSJZmSSKspSj2yu6q7ql69OYeYw4vvnrg3qwgZ8oK5YN5F9uuszIjIiHPPPfc73/lOVNc1EEURQBwNf/dEQAdAC0BHD/R9D/QRQNN3QN10QBcBJEkC9Pp81wFdHwNxHGNDn9RZIhg+33QtP27o8xr6Vkw8fLfpayCPMqClA5quAbI4A3IioNb7bQNMkxxYN+VwtaMoBZq+BeIoBmIioGyq4ZjjdAzUfQ2Momw4Wtu2wDwfAcuiALJs9MxdioLf3vQAMfvxEx+RLD20cQ3ZeB/FQEsPdH3PYL+y+liPMvGf6brhOEmUDMdp2m741y2r7/vhnTyOgObvvFzNBTeTep3r2fPqN+h3yRJHoxEwjTPM6quqApIoBrIsGz7fNM3wTp762aNz1WU1nOVgNBl+3XqzAWaTCdDqLrUwzOkkAvpe96Fnb+k7GVHdetvqtyxdz6dn29LdiOXxYyAO7EtPf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cpnbm4ugePjE6zm4Qd/80PgyYMbLOq4e+9F4LOfeXm4QqfGpS5OwuI739Wxb/zuWjsJDVd5UnkuZhQoVVtcJDTf0SvYRih1T/aWvoORbmf9ve/ug3yNWa7fiyaOn+W/+nzWVNOkR51apH51g9VfqwvSz37ty8AXPv8aplG0uroE4kgdCnxXxMj1hFO1ho8KXnrlpeHsSVcBXbEEnj46xXS4XrrzBeDkQNruCVYN5CxdZ0l8xO3qkpxm2Q2eURwDdaZMQMTQl251BayuzjCtazEXnT9QlXTgCfaWvoORWo8LwJlymNt0tZ1BVBMyEWNv+j8mxreaBJ+ZTPMWmB+kwHJdAJPpGEMnWEyA9N4J0KtHeuP7rrsjRwlWU6rT91LErUrgaDECPv/aZ4CTowUWw3z2M5/WNQL0qu2LgU7N4qMaGGmd0DFTgFGWAocz3zXSdd6o/boVVpSL4R7qvNsq6Ouvu32ngF2NNPwfs83AgANP7WxNohMikjzHC3P5w8DZt636oKjPRgxk4xzTQ1LUv5jkmHKA9pOpi6ZkUx2+B3vMdj1c2nUMfeNmU+DlF18ErpfL4bco+yqupCKNUeY7R7e19B0TLFhrQlW9WJGM7DcCmsRjqEkyBTg+ZLt/e8imF+umC65zb+k7GKmeqjD0LUxRf+P3nxpVI7wNfhwOEw5jgMRYl1xFLPqW05QTwyBqMI6u0qWp2wekDDkpzSShesH6kRNjSgDSKDpczDEU0O0eAMhObmPzRmr/ZZkCVaGOfSkWldWVr31uuoCD6Py158CEGQjHjyx9Vyan/KSKlLIGlvvoZVfj/wJy9v4C/KrTWAAAAABJRU5ErkJggg==",
      "text/plain": [
       "80×62 Array{RGB{N0f8},2} with eltype RGB{Normed{UInt8,8}}:\n",
       " RGB{N0f8}(0.984,0.984,0.984)  RGB{N0f8}(0.988,0.988,0.988)  …  RGB{N0f8}(0.914,0.996,1.0)    RGB{N0f8}(0.898,0.992,1.0)  \n",
       " RGB{N0f8}(0.984,0.984,0.984)  RGB{N0f8}(0.984,0.992,0.988)     RGB{N0f8}(0.918,0.996,1.0)    RGB{N0f8}(0.902,0.984,0.996)\n",
       " RGB{N0f8}(0.984,0.992,0.988)  RGB{N0f8}(0.984,0.992,0.988)     RGB{N0f8}(0.933,0.992,1.0)    RGB{N0f8}(0.91,0.98,0.988)  \n",
       " RGB{N0f8}(0.98,0.996,0.992)   RGB{N0f8}(0.98,0.996,0.992)      RGB{N0f8}(0.949,0.992,1.0)    RGB{N0f8}(0.925,0.98,0.992) \n",
       " RGB{N0f8}(0.969,1.0,0.992)    RGB{N0f8}(0.969,1.0,0.992)       RGB{N0f8}(0.949,0.988,0.996)  RGB{N0f8}(0.937,0.976,0.984)\n",
       " RGB{N0f8}(0.961,1.0,0.996)    RGB{N0f8}(0.961,1.0,0.996)    …  RGB{N0f8}(0.953,0.984,0.996)  RGB{N0f8}(0.941,0.973,0.984)\n",
       " RGB{N0f8}(0.949,0.996,0.988)  RGB{N0f8}(0.949,0.996,0.988)     RGB{N0f8}(0.961,0.992,1.0)    RGB{N0f8}(0.949,0.98,0.988) \n",
       " RGB{N0f8}(0.933,0.992,0.98)   RGB{N0f8}(0.933,0.992,0.98)      RGB{N0f8}(0.969,1.0,1.0)      RGB{N0f8}(0.957,0.996,1.0)  \n",
       " RGB{N0f8}(0.933,0.992,0.98)   RGB{N0f8}(0.937,0.996,0.984)     RGB{N0f8}(0.945,1.0,1.0)      RGB{N0f8}(0.929,0.984,0.984)\n",
       " RGB{N0f8}(0.929,0.992,0.98)   RGB{N0f8}(0.937,0.996,0.984)     RGB{N0f8}(0.925,1.0,0.992)    RGB{N0f8}(0.914,0.988,0.98) \n",
       " RGB{N0f8}(0.929,0.992,0.98)   RGB{N0f8}(0.937,0.996,0.984)  …  RGB{N0f8}(0.918,0.996,0.988)  RGB{N0f8}(0.906,0.984,0.976)\n",
       " RGB{N0f8}(0.933,0.988,0.988)  RGB{N0f8}(0.937,0.992,0.992)     RGB{N0f8}(0.91,0.996,0.988)   RGB{N0f8}(0.898,0.984,0.976)\n",
       " RGB{N0f8}(0.933,0.988,0.988)  RGB{N0f8}(0.937,0.992,0.992)     RGB{N0f8}(0.91,0.996,0.988)   RGB{N0f8}(0.898,0.984,0.976)\n",
       " ⋮                                                           ⋱  ⋮                                                         \n",
       " RGB{N0f8}(0.722,0.659,0.596)  RGB{N0f8}(0.729,0.667,0.604)     RGB{N0f8}(0.2,0.224,0.184)    RGB{N0f8}(0.2,0.224,0.184)  \n",
       " RGB{N0f8}(0.686,0.624,0.561)  RGB{N0f8}(0.69,0.627,0.565)      RGB{N0f8}(0.239,0.251,0.208)  RGB{N0f8}(0.227,0.239,0.196)\n",
       " RGB{N0f8}(0.663,0.604,0.529)  RGB{N0f8}(0.675,0.608,0.545)  …  RGB{N0f8}(0.302,0.31,0.259)   RGB{N0f8}(0.294,0.302,0.251)\n",
       " RGB{N0f8}(0.651,0.584,0.514)  RGB{N0f8}(0.659,0.592,0.522)     RGB{N0f8}(0.306,0.298,0.247)  RGB{N0f8}(0.318,0.31,0.259) \n",
       " RGB{N0f8}(0.675,0.608,0.537)  RGB{N0f8}(0.675,0.608,0.537)     RGB{N0f8}(0.345,0.322,0.259)  RGB{N0f8}(0.333,0.31,0.247) \n",
       " RGB{N0f8}(0.702,0.635,0.557)  RGB{N0f8}(0.702,0.635,0.557)     RGB{N0f8}(0.38,0.345,0.278)   RGB{N0f8}(0.396,0.361,0.294)\n",
       " RGB{N0f8}(0.722,0.655,0.576)  RGB{N0f8}(0.718,0.651,0.573)     RGB{N0f8}(0.447,0.396,0.322)  RGB{N0f8}(0.471,0.42,0.345) \n",
       " RGB{N0f8}(0.722,0.659,0.569)  RGB{N0f8}(0.718,0.655,0.565)  …  RGB{N0f8}(0.498,0.427,0.349)  RGB{N0f8}(0.498,0.427,0.341)\n",
       " RGB{N0f8}(0.729,0.667,0.576)  RGB{N0f8}(0.729,0.667,0.576)     RGB{N0f8}(0.506,0.42,0.329)   RGB{N0f8}(0.498,0.412,0.322)\n",
       " RGB{N0f8}(0.749,0.678,0.592)  RGB{N0f8}(0.749,0.678,0.592)     RGB{N0f8}(0.533,0.431,0.341)  RGB{N0f8}(0.525,0.424,0.333)\n",
       " RGB{N0f8}(0.749,0.678,0.592)  RGB{N0f8}(0.749,0.678,0.592)     RGB{N0f8}(0.588,0.478,0.384)  RGB{N0f8}(0.565,0.455,0.361)\n",
       " RGB{N0f8}(0.733,0.663,0.569)  RGB{N0f8}(0.741,0.671,0.584)     RGB{N0f8}(0.635,0.518,0.424)  RGB{N0f8}(0.588,0.471,0.376)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "using FileIO\n",
    "img = download(\"http://home.mweb.co.za/pa/pak04857/uniweb/animalimages/elephantthumb.jpg\")\n",
    "load(img)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resnet.jl (c) Ilker Kesen, 2017. Classifying images with Deep Residual Networks.\n",
      "opts=(:atype, \"KnetArray{Float32}\")(:top, 5)(:image, \"elephantthumb.jpg\")(:model, \"imagenet-resnet-101-dag\")\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "┌ Info: Loading imagenet-resnet-101-dag.mat...\n",
      "└ @ Main.ResNet /kuacc/users/dyuret/.julia/dev/Knet/data/imagenet.jl:14\n",
      "┌ Info: Reading elephantthumb.jpg\n",
      "└ @ Main.ResNet /scratch/users/dyuret/.julia/dev/Knet/examples/resnet/resnet.jl:52\n",
      "┌ Info: Classifying with resnet101\n",
      "└ @ Main.ResNet /scratch/users/dyuret/.julia/dev/Knet/examples/resnet/resnet.jl:64\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "5×2 Array{Any,2}:\n",
       " 0.303951   \"African elephant, Loxodonta africana\"      \n",
       " 0.134402   \"tusker\"                                    \n",
       " 0.0889063  \"wood rabbit, cottontail, cottontail rabbit\"\n",
       " 0.0654141  \"Indian elephant, Elephas maximus\"          \n",
       " 0.0579414  \"three-toed sloth, ai, Bradypus tridactylus\""
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  0.728850 seconds (1.19 M allocations: 58.050 MiB, 17.60% gc time)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "ResNet.main(img)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 1.0.0",
   "language": "julia",
   "name": "julia-1.0"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "1.0.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
